= render layout: 'tenon/fields/base', locals: { f: f, method_name: method_name, opts: opts } do
  %div{ class: opts[:wrapper_class] }
    .asset-field
      = f.hidden_field "#{method_name}_id", data: { asset_id_field: true }

      .asset-field__thumbnail{ data: { asset_thumbnail: true } }
        - if proxy_attachment.try(:asset)
          = asset_icon(proxy_attachment.asset)
        - else
          = image_tag default_asset_thumbnail(proxy_attachment)

      .asset-field__details
        .asset-field__title{ data: { asset_info: true } }
          - if proxy_attachment
            = proxy_attachment.display_name
          - else
            No asset selected.

        .asset-field__actions{ class: ('with-remove' if opts[:remove_association]) }
          .asset-field__action
            = link_to 'Browse', new_item_asset_path, class: 'action-text', data: { modal_remote: true, modal_title: "Select #{method_name.to_s.titleize}", modal_handler: 'AssetAttachment' }
          - if opts[:remove_association]
            .asset-field__action{ data: { asset_remove: true } }
              = link_to_remove_association 'remove', f, class: 'action-text action-text--secondary'
          - else
            .asset-field__action{ data: { asset_remove: true }, style: ('display: none;' unless f.object.send("#{method_name}_id").present?) }
              = link_to 'remove', '#', class: 'remove-asset action-text action-text--secondary', data: { confirm: 'Are you sure?' }



      .spacer
